void main() {
//  js();
//  relation();
//  judge();
  weiyi();
}

void js() {
  print(2 + 3 == 5);
  print(2 - 3 == -1);
  print(2 * 3 == 6);
  print(5 / 2 == 2.5); // 结果是双浮点型
  print(5 ~/ 2 == 2); // 结果是整型
  print(5 % 2 == 1); // 余数

  print('5/2 = ${5 ~/ 2} r ${5 % 2}' == '5/2 = 2 r 1');
}

void relation() {
  print(2 == 2);
  print(2 != 3);
  print(3 > 2);
  print(2 < 3);
  print(3 >= 3);
  print(2 <= 3);
}

void judge() {
  var person = new Person();
  person.name = "小明";
  if (person is Person) {
    print(person.name);
  }
}

class Person {
  String name = "测试";
}

void weiyi() {
  final value = 0x22;
  final bitmask = 0x0f;

  print((value & bitmask) == 0x02); // AND
  print((value & ~bitmask) == 0x20); // AND NOT
  print((value | bitmask) == 0x2f); // OR
  print((value ^ bitmask) == 0x2d); // XOR
  print((value << 4)); // 左位移
  print((value >> 4)); // 右位移
  print((value << 4) == 0x220);
  print((value >> 4) == 0x02);
}

class Button {
  var text;
  var num;
}

// 级联运算符
void lianji() {
  var btn = getBtn()
    ..text = "确定"
    ..num = 1;
  print(btn.text);
}

Button getBtn() {
  return new Button();
}